const list = [
  { id: 0, router: 'K2', routeMode: 0, modeDes: '' },
  { id: 1, router: 'K11', routeMode: 0, modeDes: '' },
  { id: 2, router: 'P1', routeMode: 0, modeDes: '' },
  { id: 3, router: 'P10', routeMode: 1, modeDes: '1' }
]
const modeList = [
  { id: '0', value: '手动路由决策一' },
  { id: '1', value: '手动路由决策二' },
  { id: '2', value: '手动路由决策三' },
  { id: '3', value: '手动路由决策四' },
  { id: '4', value: '手动路由决策五' },
  { id: '5', value: '手动路由决策六' },
  { id: '6', value: '手动路由决策七' },
  { id: '7', value: '手动路由决策八' },
  { id: '8', value: '手动路由决策九' },
  { id: '9', value: '手动路由决策十' }
]
export default [
  // 获取数据
  {
    url: '/bdc/route-mode-ctrl',
    type: 'get',
    response: () => {
      return {
        code: 20000,
        data: list
      }
    }
  },
  // 获取路由决策列表(链接不要写前部完全相同的，会被直接拦截到前面的请求上，如/bdc/route-mode-ctrl/mode/list)
  {
    url: '/bdc/mode/list',
    type: 'get',
    response: () => {
      return {
        code: 20000,
        data: modeList,
        message: 'modeList'
      }
    }
  },
  // 自动路由控制
  {
    url: '/bdc/route-mode-ctrl/auto/[A-Za-z0-9]',
    type: 'post',
    response: config => {
      const id = config.url.split('/')[config.url.split('/').length - 1]
      const item = list.find(a => a.id === Number(id))
      item.routeMode = 0
      item.modeDes = ''
      return {
        code: 20000,
        data: 'success'
      }
    }
  },
  // 手动路由控制
  {
    url: '/bdc/route-mode-ctrl/manual',
    type: 'post',
    response: config => {
      const item = config.body
      const index = list.indexOf(list.find(a => a.id === item.id))
      list[index] = item
      return {
        code: 20000,
        data: 'success'
      }
    }
  }
]
